package edu.sctu.practice.class01.wulixia.month09_wlx.assign03.two;

/**
 * Created by wulixia on 2015/11/4.
 * 主方法中分别创建两个ComparableCircle类对象和两个ComparableCylinder类对象，
 * 并分别以它们为参数调用max方法，返回两个对象中面积较大的一个。
 */
public class TestInterface {
    public static void main(String[] args) {

        ComparableCircle circle1 = new ComparableCircle(5);
        ComparableCircle circle2 = new ComparableCircle(4);
        Comparable circle = Max.max(circle1, circle2);

        System.out.println("最大的圆的半径是" + ((Circle) circle).getRadius());
        System.out.println(circle);

        ComparableCylinder cylinder1 = new ComparableCylinder(5, 2);
        ComparableCylinder cylinder2 = new ComparableCylinder(4, 5);
        Comparable cylinder = Max.max(cylinder1, cylinder2);

        System.out.println();
        System.out.println("圆柱1的体积是" + cylinder1.findVolume());
        System.out.println("圆柱2的体积是" + cylinder2.findVolume());
        System.out.println("最大的圆柱的\n半径是 " + ((Cylinder) cylinder).getRadius() + "\n长是： " + ((Cylinder) cylinder).getLength() + "\n体积是： " + ((Cylinder) cylinder).findVolume());
        System.out.println(cylinder);
    }

}
